import 'package:flutter/material.dart';

class FindPage extends StatefulWidget {
  FindPage({Key key}) : super(key: key);

  // @overrid
  _FindPageState createState() => _FindPageState();
}

class _FindPageState extends State<FindPage> {
  List tabs = ["关注", "推荐", "问答","职测"];
  

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
        length: 4,
        child: Scaffold(
            appBar: AppBar(
              title: Row(
                children: [
                  Text(
                    "发现",
                    style: TextStyle(color: Colors.white),
                  ),
                  Expanded(
                    child: Container(
                      margin: EdgeInsets.only(left: 8.0),
                      padding: EdgeInsets.all(8.0),
                      alignment: Alignment.centerLeft,
                      width: 180.0,
                      height: 35.0,
                      child: Icon(Icons.search, color: Colors.white),
                      decoration: BoxDecoration(
                          color: Colors.black26, //使用了decorationn 要把颜色写在里面
                          borderRadius: BorderRadius.all(Radius.circular(20))),
                    ),
                  ),
                  IconButton(
                    icon: Icon(
                      Icons.access_alarm,
                      size: 28.0,
                      color: Colors.white,
                    ),
                    onPressed: () {
                      print('点击游戏');
                    },
                  ),
                  GestureDetector(
                    onTap: () {
                      // Navigator.pushNamed(context, '/person');
                      //使用自定义的渐入动画
                      // Navigator.of(context).push(CustomRoute(PersonPage()));
                    },
                    child: ClipOval(
                      child: Image.network(
                        'https://i0.hdslb.com/bfs/face/member/noface.jpg@140w_140h_1c.webp',
                        width: 30.0,
                        height: 30.0,
                      ),
                    ),
                  ),
                ],
              ),
            ),
            body: Column(
              children: [
                TabBar(
                  indicatorColor: Color.fromARGB(255, 0, 215, 198), //指示器颜色
                  labelColor: Colors.black87, //tab文字颜色
                  unselectedLabelColor: Colors.grey,
                  indicatorSize: TabBarIndicatorSize.label,
                  tabs: tabs.map((e) => Tab(text: e)).toList(),

                  // tabs: <Widget>[
                  //   Tab(text: ""),
                  //   Tab(
                  //     text: "自行车",
                  //   ),
                  //   Tab(
                  //     text: '轮船',
                  //   ),
                  // ]
                ),
                Container(
                  decoration: BoxDecoration(
                    border: Border(
                      bottom: BorderSide(
                        width: 0.5,
                        color:Colors.grey 
                      )
                    ) // 也可控件一边圆角大小
                  ),
                ),
                Expanded(
                  child: TabBarView(children: <Widget>[
                    Center(child: Text('关注')),
                    Center(child: Text('推荐')),
                    Center(child: Text('问答')),
                    Center(child: Text('职测')),
                  ]),
                )
              ],
            )));
  }
}
